require 'View/UIBase/UIBase'

UIActivityLifeGiftTips = UIBase.New(PanelNames.UIActivityLifeGiftTips);
local this=UIActivityLifeGiftTips
function this.Init(func,activeId)
    this.activeId=activeId
    UIBase.Init(this, func);
end

function this:OnCreate()
    self.list=self:GetChild("n3")
    self.btnClose=self:GetChild("bgClose")

    self.list.numItems=0
    self.list.itemRenderer=function(index,obj)
        self:SetData(index+1,obj)
    end
    self:addEvent();
end
function this:OnEnable()
    self.tableData,self.netData=logicMgr.ActiveManager.getActiveData(self.activeId)

    self.list.numItems=0
    self.list.numItems=#self.tableData.showDatas
end

function this:OnDisable()

end

function this:OnDestroy()

end
-------------------------------function--------------------------------------
function this:OnClickClose()
    self:OnBack()
end
function this:addEvent()
    self:RegisterOnClick(self.btnClose,self.OnClickClose)
end
function this:SetData(index,obj)
    local data=self.tableData.showDatas[index]
    local itemList=obj:GetChild("ItemList")
    local nameText=obj:GetChild("Name")
    local nowCtrl=obj:GetController("IsNew")
    if data.f_Id==self.netData.stage then
        nowCtrl.selectedIndex=1
    else
        nowCtrl.selectedIndex=0
    end
    nameText.text=getLanguage(data.f_Name)
    logicMgr.CostManager.RefreshItemList(itemList,data.f_Award)
end
function this:Refresh()

end
function this:RefreshUI()

end
return this;